﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Cstudy.DAL
{
    public class resourcesclass
    {
        public bool AddResourcesClass(MODEL.resourcesclass resclass)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classname",resclass.ClassName),
                new SqlParameter("@resdescription",resclass.Descscript)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_AddResourcesClass", parms);
        }

        public bool DeleteResourcesClass(int classid)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classid",classid)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_DeleteResourcesClass", parms);
        }

        public bool UpdateResourcesClass(MODEL.resourcesclass resclass)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@classname",resclass.ClassName),
                new SqlParameter("@resdescription",resclass.Descscript)
            };
            return COM.SQLHelper.ExecuteNonQuery("sp_UpdateResourcesClass", parms);
        }

        public DataSet SelectResourcesClass()
        {
            return COM.SQLHelper.ExecuteQuery("sp_SelectResourcesClass");
        }
    }
}
